from django.db import models

from utils.BaseModel import BaseModel


# Create your models here.
class Category(BaseModel):
    cname = models.CharField(max_length=50, verbose_name='分类名称')
    parent = models.ForeignKey('self', null=True, blank=True, on_delete=models.CASCADE, verbose_name='上级分类', related_name='children')
    ishome = models.BooleanField(default=True, verbose_name='是否推在首页')
    isgood = models.BooleanField(default=True, verbose_name='是否为精品课分类')

    class Meta:
        verbose_name = '课程分类'
        db_table = 'fgcategory'

    def __str__(self):
        return self.cname
